/**
 * Created by kinghackers on 2016/11/29.
 */

var express = require('express');
var path = require('path');
var upload = require('../my_modules/m_upload');
var router = express.Router();

router.get('/', function(req, res, next) {
    res.render('fileupload', { title: 'fileupload示例' });
});

router.post("/upload", function (req, res, next) {
    upload.upload(req, {}, function (err, result) {
        if(err){
            res.send(err);
        }
        res.send(result);
    })
});

router.post("/delete", function (req, res, next) {
    upload.delete(req, function (result) {
        res.send(result);
    })
});

module.exports = router;